package com.gary.spring.awreInit;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author peng_rui
 * @date 2022/6/26
 */
@Configuration
public class MyConfig2 implements InitializingBean, ApplicationContextAware {

    @Override
    public void setApplicationContext(ApplicationContext context) {
        System.out.println("context " + context);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("config1 初始化");
    }

//    @Bean
//    public BeanFactoryPostProcessor beanFactory() {
//        return beanFactory -> {
//            System.out.println("beanFactory... + 自注入 beanFactory");
//        };
//    }
}
